(function(win, key) {
    win[key] = window[key] || {};
    win[key].punishPath = "https://domainapi.aliyun.com:443//onsale/search_____tmd_____/punish?punishFlowType=jsonp&callback=true&x5secdata=xda325cb0f8c167f5115ecf2f09c711a86623ecaaa91a9cab01691463741a-772781042a1734302932abaac2caa__bx__domainapi.aliyun.com%3A443%2Fonsale%2Fsearch&x5step=2&action=captcha&pureCaptcha=";
}
)(window, "__baxia__");

!function() {
    "use strict";
    var e = window
      , n = function(n, t) {
        var r = e.__baxia__ || {};
        return n ? r[n] || t : r
    }
      , t = function(n, t) {
        e.__baxia__ = e.__baxia__ || {},
        e.__baxia__[n] = t
    }
      , r = location
      , a = document
      , i = function(e, n, t) {
        (void 0 === n && (n = 1),
        void 0 === t && (t = .1),
        0 >= t || Math.random() < t) && function(e, n) {
            var t = [];
            for (var r in e)
                t.push(r + "=" + encodeURIComponent(e[r]));
            (new Image).src = n + t.join("&")
        }({
            code: n,
            msg: (e + "").substr(0, 1e3) + ";v:2.5.1",
            pid: "baxia",
            page: r.href.split(/[#?]/)[0],
            query: r.search.substr(1),
            hash: r.hash,
            referrer: a.referrer,
            title: a.title,
            ua: navigator.userAgent
        }, "//gm.mmstat.com/fsp.1.1?")
    };
    var o = document;
    try {
        var s = document;
        ({
            init: function() {
                this.punishPath = n("punishPath", "https://www.taobao.com/markets/bx/deny_h5"),
                this.dialogSize = n("dialogSize", ""),
                t("punishPath", ""),
                this.listenOnLoad()
            },
            getCurrentScript: function() {
                if (s.currentScript)
                    return s.currentScript;
                var e = null
                  , n = document.getElementsByTagName("script")
                  , t = null;
                try {
                    throw Error()
                } catch (i) {
                    var r, a = (/.*at [^\(]*\((.*):.+:.+\)$/gi.exec(i.stack) || [!1])[1];
                    for (r in n)
                        if ((t = n[r]).src == a || "interactive" == t.readyState)
                            return e = n[r],
                            n[r]
                }
                return e
            },
            updatejQueryEvent: function(e, n, t) {
                var r = window.jQuery;
                r && (r.event.triggered = n,
                t && r(e).trigger(t))
            },
            getHandlerPath: function(e, t) {
                return t.jsPath ? t.jsPath : "" + n("cdnPath", "https://g.alicdn.com/sd/baxia/2.5.1/") + e + ".js"
            },
            listenOnLoad: function() {
                var e = this.getCurrentScript();
                this.updatejQueryEvent("", "load");
                var n = e.onreadystatechange || e.onload
                  , t = this;
                e.onload = function() {
                    var e = this;
                    this.onload = this.onreadystatechange = null,
                    t.handler("Jsonp", {
                        result: {
                            rgv587_flag: "sm",
                            url: t.punishPath,
                            dialogSize: t.dialogSize
                        },
                        config: {
                            url: this.src,
                            done: function() {
                                e.readyState = "loaded",
                                n && n.call(e, "", !1),
                                t.updatejQueryEvent(e, "", "load")
                            },
                            fail: function() {
                                e.readyState = "error",
                                n && n.call(e, "", !1),
                                t.updatejQueryEvent(e, "", "error")
                            }
                        }
                    })
                }
            },
            handler: function(e, r) {
                void 0 === e && (e = "Xhr"),
                void 0 === r && (r = {});
                var a = n("pluginInstance", null)
                  , s = n("handlerQueue", []);
                try {
                    if (a)
                        return a.handler(r);
                    s.push({
                        pluginName: e,
                        props: r
                    });
                    var u = s[0]
                      , l = "baxia" + u.pluginName + "Handler"
                      , c = this.getHandlerPath(l, u.props);
                    t("handlerQueue", s),
                    function(e, n, t) {
                        if (!e)
                            return n();
                        var r = o.getElementsByTagName("script")[0]
                          , a = o.createElement("script");
                        if (a.async = !0,
                        a.src = e,
                        e.indexOf("alicdn") > -1 && (a.crossOrigin = !0),
                        a.onerror = function(n) {
                            i("function:loadJS. msg:" + e + "load error。props：" + JSON.stringify(t)),
                            a.onerror = null
                        }
                        ,
                        n) {
                            var s = !1;
                            a.onload = a.onreadystatechange = function() {
                                s || a.readyState && !/loaded|complete/.test(a.readyState) || (a.onload = a.onreadystatechange = null,
                                s = !0,
                                n())
                            }
                        }
                        r.parentNode.insertBefore(a, r)
                    }(c, function() {
                        var e = n("pluginInstance", null);
                        if (e) {
                            s = n("handlerQueue", []);
                            for (var r = 0; s.length > r; r++)
                                e.handler(s[r].props)
                        } else {
                            s = n("handlerQueue", []),
                            e = new window[l];
                            for (r = 0; s.length > r; r++)
                                e.handler(s[r].props);
                            t("pluginInstance", e),
                            t("handlerQueue", [])
                        }
                    })
                } catch (d) {
                    t("pluginInstance", null),
                    i("handler err，param:" + JSON.stringify(arguments) + "," + d.message + d.stack)
                }
            }
        }).init()
    } catch (u) {
        i("Hook JSONP ，Message:" + u.message, 13, .1)
    }
}();
